package com.ybkj.daijia.template.shiro;

public class HaveAnyPermissionsTag extends PermissionTag {

    private static final String ROLE_NAMES_DELIMETER = ",";

    protected boolean showTagBody(String ps) {
        boolean hasAnyRole = false;

        // Iterate through roles and check to see if the user has one of the roles
        for (String role : ps.split(ROLE_NAMES_DELIMETER)) {
            if (isPermitted(role.trim())) {
                hasAnyRole = true;
                break;
            }
        }

        return hasAnyRole;
    }
}
